<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // var arr = [23, 54, 545, 2, 43, 3];
    // console.log(arr.reverse());
    var arr = [23, 54, 545, 2, 43, 3];
    for (var i = 0; i < arr.length; i++) {
      if (i < Math.floor(arr.length/2) ) {
        var temp = arr[i];
        arr[i] = arr[arr.length-i-1];
        arr[arr.length-i-1] = temp;
      } else {
        break;
      }
    }
    console.log(arr);
  </script>
</body>
</html>